<?php
/**
 * @version		$Id$
 * @package		ALM Hoster
 * @desription	Web hosting and domain menager for resellers
 * @subpackage	Components
 * @copyright	Copyright (C) 2011 ALM Studio. All rights reserved.
 * @author		ALM Studio
 * @email		info@alm-studio.net
 * @link		http://alm-studio.net
 * @license		Commercial
 */

// No direct access to this file
defined('_JEXEC') or die('Restricted access');

jimport('joomla.application.component.modellist');

class AlmHosterModelEmail_tmpls extends JModelList
{

	public function __construct($config = array())
	{
		if (empty($config['filter_fields'])) {
			$config['filter_fields'] = array(
				'TmplId', 'a.TmplId',
				'TmplKey', 'a.TmplKey',
				'TmplFromName', 'a.TmplFromName',
				'TmplFromEmail', 'a.TmplFromEmail',		
				'TmplCopyTo', 'a.TmplCopyTo',
				'TmplSubjekt', 'a.TmplSubjekt',
				'TmplText', 'a.TmplText'
			);
		}

		parent::__construct($config);
	}
	
	protected function populateState($ordering = null, $direction = null)
	{

		$app = JFactory::getApplication('administrator');
		
		parent::populateState('a.TmplId', 'asc');		
				
	}
	
	protected function getListQuery() 
	{
		$db = JFactory::getDBO();
		$query = $db->getQuery(true);
		
		
		$query->select($this->getState('list.select', 'a.*'));
		
		$query->from('#__almh_email_tmpl AS a');
		
		$query->order($db->getEscaped($this->getState('list.ordering', 'a.TmplId')).' '.$db->getEscaped($this->getState('list.direction', 'asc')));
			
		return $query;		
	}
}
?>